﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Collections;

public partial class Registration : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string date=DateTime.Now.ToString("yyyy - MM - dd");
            string sql = string.Format("select * from Scheduling where DauyDate >= '{0}'",date);
            DataSet ds = DBHelper.GetDataSet(sql);
            DataList1.DataSource = ds;
            DataBind();
            ds.Clone();
            
            string sql1= string.Format("select * from Scheduling where DauyDate >= '{0}'", date);
            SqlDataReader dr = DBHelper.GetDataReader(sql1);
            ArrayList ks = new ArrayList();
            while (dr.Read())
            {
                ks.Add(dr["DetName"].ToString());
            }
            DropDownList1.DataSource = ks;
            DropDownList1.DataBind();
            dr.Close();
        }
    }

    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        string date = DateTime.Now.ToString("yyyy - MM - dd");
        string DetName=DropDownList1.SelectedValue.ToString();
        string sql = string.Format("select * from Scheduling where DetName='{0}' and DauyDate>='{1}'",DetName,date);
        DataSet set = DBHelper.GetDataSet(sql);
        DataList1.DataSource = set;
        DataList1.DataBind();
        set.Clone();
    }

    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        string date = DateTime.Now.ToString("yyyy - MM - dd");
        string sql = string.Format("select * from Scheduling where DauyDate >= '{0}'", date);
        DataSet ds = DBHelper.GetDataSet(sql);
        DataList1.DataSource = ds;
        DataBind();
        ds.Clone();
    }

    public string Get(string P)
    {
        int p1 = P.Length;
        P = P.Substring(0,p1 -7);
        return P;
    }
}